<html>
    <head>
        <meta charset="UTF-8">
        <title>{$meta_title}</title>
        <meta name="keywords" content="户学教育">
        <meta name="Description" content="户学教育"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,  user-scalable=0;"/>
        <link rel="stylesheet" href="{HOME_THEME_PATH}../gw/css/common.css?t={time()}.{rand(10000,9999999)}">
        <link rel="stylesheet" href="{HOME_THEME_PATH}../gw/css/login.css?t={time()}.{rand(10000,9999999)}"/>
        <link rel="stylesheet" href="{HOME_THEME_PATH}../gw/css/poup_login.css?t={time()}.{rand(10000,9999999)}"/>

        <script type="text/javascript"t src="{THEME_PATH}js/jquery.min.js?t={time()}.{rand(10000,9999999)}"></script>
        <script type="text/javascript"t src="{THEME_PATH}js/dialog-plus.js?t={time()}.{rand(10000,9999999)"></script>
        <script type="text/javascript" src="{THEME_PATH}js/jquery.artDialog.js?t={time()}.{rand(10000,9999999)}&skin=default"></script>
        <script type="text/javascript" src="{THEME_PATH}js/dayrui.js?t={time()}.{rand(10000,9999999)"></script>
        <script type="text/javascript" src="{HOME_THEME_PATH}../gw/js/le_include_head.js?t={time()}.{rand(10000,9999999)}"></script>
    </head>
    <body class="le-poup-login">
        <div class="main">
            <div class="part part2 ">
                    <form action="" method="post" id="myform">
                        <div class="le-number">
                            <input type="text" class="input-item input-phone" placeholder="请输入您的手机号" name="mobile">
                            <img src="{HOME_THEME_PATH}../gw/img/clean-2-4.svg" alt="" class="le-clean-phone">
                            <div class="le-error-message"></div>
                        </div>
                        <div class="le-password">
                            <input type="password" class="input-item input-password" placeholder="请输入您的密码" name="pass">
                            <img src="{HOME_THEME_PATH}../gw/img/clean-2-4.svg" alt="" class="le-clean-pass">
                            <div class="le-error-message"></div>
                        </div>
                        <div class="form-btn" onclick="dr_login();">登录</div>
                        <div class="form-btns">
                            <!-- <a class="form-btn1" href="./index.php?s=user&c=register&m=poup_register">快速注册</a> -->
                            <a class="form-btn2" href="./index.php?s=user&c=forget&m=poup_forget">忘记密码？</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </body>
    <script>
        function le_error_message(le_position,message){
            $(le_position).text(message).fadeIn();
            $(le_position).delay(2000).fadeOut();
        }

        $(".le-clean-phone").click(function(){
            $(".input-phone").val("");
        });

        $(".le-clean-pass").click(function(){
            $(".input-password").val("");
        });

        $(".input-phone").focusout(function(){
            var phone = $(".input-phone").val();
            if(!phone){
                le_error_message(".le-number >.le-error-message","手机号码不能为空");
                return false;
            }
            if(!(/^1[34578]\d{9}$/.test(phone))){
                le_error_message(".le-number>.le-error-message","手机号格式不对");
                return false;
            }
        });

        $(".input-password").focusout(function(){
            var pass = $(".input-password").val();
            if(!pass) {
                le_error_message(".le-password>.le-error-message", "密码不能为空");
                return false;
            }
        });

        $(".le-login-form .form-btn").click(function(){
            le_login_data();
        });

        function le_login_data(){
            var phone = $(".input-phone").val(),
                pass = $(".input-password").val();
            if(!phone){
                return false;
            }
            if(phone&&!pass){
                return false;
            }
            if(!(/^1[34578]\d{9}$/.test(phone))){
                return false;
            }
            var post = {'phone':phone,'pass':pass};
        }

        $(".le-poup-login .form-btn1").click(function () {
            $(window.parent.document).find("#login-title").removeClass("active");
            $(window.parent.document).find("#registor-title").addClass("active");
        });

        var url = parent.document.URL;
        var mySplitResult = url.split(/&/);
        var length = mySplitResult.length;
        var publicClass_check = 0;
        for(var i = 0;i<length;i++){
            if(mySplitResult[i]=="c=publicClass"){
                publicClass_check = 1;
            }
        }
        function dr_login(){
            var phone = $(".input-phone").val(),
                pass = $(".input-password").val();
            var post = {'phone':phone,'pass':pass};
            $.ajax({type: "POST",dataType:"json", url: "{dr_now_url()}", data: post,
                success: function(data) {
                    if (data.status) {
                        $(".form-btn").text("登录成功，即将为您跳转...").css("background","rgb(189, 189, 189)").css("font-size","16px");
                        setTimeout(function () {

                            if(publicClass_check == 1){
                                // 公开课
                                parent.document.location.href = './index.php?s=user&c=publicClass&m=index';
                            }
                            else{
                                // 用户中心
                                parent.document.location.href = './index.php?s=user';
                            }



                        }, 2000);

                    } else {
                        $('#dr_code_img').click();
                        dr_tips(data.code);
                    }
                },
                error: function(HttpRequest, ajaxOptions, thrownError) {
                }
            });
        }
    </script>
</html>
